import { queryList, querySelect, queryInfo, saveOrder, updateOrder, confirmOrder, cancelOrder, shipmentOrder, receiptOrder, deleteOrder } from '@/api/order'

const state = {}

const mutations = {}

const actions = {
    queryList({ commit }, params) {
        return new Promise(resolve => {
            queryList(params).then(response => {
                resolve(response.data)
            });
        })
    },
    querySelect({ commit }, params) {
        return querySelect(params);
    },
    queryInfo({ commit }, id) {
        return queryInfo(id);
    },
    saveOrder({ commit }, data) {
        return saveOrder(data);
    },
    updateOrder({ commit }, data) {
        return updateOrder(data);
    },
    confirmOrder({ commit }, id) {
        return confirmOrder(id);
    },
    cancelOrder({ commit }, id) {
        return cancelOrder(id);
    },
    shipmentOrder({ commit }, data) {
        return shipmentOrder(data);
    },
    receiptOrder({ commit }, id) {
        return receiptOrder(id);
    },
    deleteOrder({ commit }, id) {
        return deleteOrder(id);
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
